<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta id="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="apple-themes-web-app-capable" content="yes">
		<meta content="yes" name="apple-mobile-web-app-capable">
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<meta content="telephone=no" name="format-detection">
		<meta content="email=no" name="format-detection">
		<meta name="format-detection" content="telephone=no">
		<title>首页</title>
        <link rel="stylesheet" href="${s.base}/mobile/css/weui.min.css">
        <link rel="stylesheet" href="${s.base}/mobile/css/jquery-weui.min.css">
        <link rel="stylesheet" href="${s.base}/mobile/css/main.css" type="text/css" media="all">
        <link rel="stylesheet" href="${s.base}/mobile/css/dropload.css" type="text/css" media="all">
	</head>

	<body>
    <header id="header">
        <div class="header_con">
            <div class="top_tit">1元夺宝</div>
        </div>
    </header>
    <div id="content_div" class="">
        <!--首页轮播-->
        <div class="top_pic">
            <div class="carousel-image" id="scroll_img">
                <div>
                    <!--<a href="#"><img src="${s.base}/mobile/images/h01.jpg" /></a>
                    <a href="#"><img src="${s.base}/mobile/images/h02.jpg" /></a>-->

                    <#list pictureList as picture>
                        <a href="javascript:void(0)"><img src="${picture.image}"/></a>
                    </#list>

                </div>
                <span class="carousel-num">
                </span>
            </div>
        </div>
        <!--首页轮播结束-->
        <div class="home_mian">
            <ul class="clearfixd">
                <li><a href="${s.base}/phone/listUpActPage?memberId=${memberId}"><i class="home_ti02"></i><p>最新揭晓</p></a></li>
                <li><a href="${s.base}/phone/pinglun?memberId=${memberId}"><i class="home_ti01"></i><p>晒单信息</p></a></li>
                <li><a href="${s.base}/phone/myWinRecord?memberId=${memberId}"><i class="home_ti03"></i><p>中奖记录</p></a></li>
                <li><a href="${s.base}/phone/myWinning?memberId=${memberId}&status=3"><i class="home_ti04"></i><p>夺宝记录</p></a></li>
            </ul>
        </div>
        <a href="${s.base}/phone/listUpActPage?memberId=${memberId}">
        <div class="home_mian_down"> <em></em><p><#if receiving.nickName??>恭喜<span>${receiving.nickName}</span>获得【${receiving.activity.title}】${receiving.item.title}<#else>暂无获奖通知消息</#if></p> <i></i></div>
        </a>
            <div class="home_cp_tit">
            <a class="change_c" data-value="1"><span>人气推荐</span></a><a data-value="2"><span>最新商品</span></a><a data-value="3"><span>即将开奖</span></a></h2>
        </div>
        <div class="home_all_box">

            <div id="showContent" class="home_cp_box clearfixd">
            </div>

        </div>
    </div>

    <footer class="zyw-footer">
        <div class="zyw-container white-bgcolor clearfix">
            <div class="weui-tabbar">
                <a href="${s.base}/phone/index?memberId=${memberId}" class="weui-tabbar__item weui-bar__item--on">
                    <div class="weui-tabbar__icon">
                        <img src="${s.base}/mobile/images/svg/foot-1-1.svg" alt="">
                    </div>
                    <p class="weui-tabbar__label"  style="color: #d91d37;">夺宝</p>
                </a>
                <a href="/phone/listUpActPage?memberId=${memberId}" class="weui-tabbar__item">
                    <div class="weui-tabbar__icon">
                        <img src="${s.base}/mobile/images/svg/foot-2.svg" alt="">
                    </div>
                    <p class="weui-tabbar__label">最新揭晓</p>
                </a>
                <a href="${s.base}/phone/pinglun?memberId=${memberId}" class="weui-tabbar__item">
                    <div class="weui-tabbar__icon">
                        <img src="${s.base}/mobile/images/svg/foot-3.svg" alt="">
                    </div>
                    <p class="weui-tabbar__label">晒单</p>
                </a>
                <a href="/phone/listCartPage?memberId=${memberId}" class="weui-tabbar__item">
                    <div class="weui-tabbar__icon">
                        <img src="${s.base}/mobile/images/svg/foot-4.svg" alt="">
                    </div>
                    <p class="weui-tabbar__label">购物车</p>
                </a>
                <a href="${s.base}/phone/home?memberId=${memberId}" class="weui-tabbar__item">
                    <div class="weui-tabbar__icon">
                        <img src="${s.base}/mobile/images/svg/foot-5.svg" alt="">
                    </div>
                    <p class="weui-tabbar__label">我的</p>
                </a>
            </div>
        </div>
    </footer>



    <div class="content">
        <div class="lists"></div>
    </div>
    <!--<script type="text/javascript" src="${s.base}/mobile/js/zepto.min.js"></script>-->
    <script type="text/javascript" src="${s.base}/mobile/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="${s.base}/mobile/js/carousel-image.js"></script>
    <script>
        $('.carousel-image').CarouselImage({
            num: $('.carousel-image .carousel-num'),
            repeat: true
        });
    </script>
    <script type="text/javascript" src="${s.base}/js/layer/layer.js"></script>
    <script type="text/javascript" src="${s.base}/js/base/commont.js"></script>
    <script src="${s.base}/mobile/js/jquery-weui.min.js"></script>
    <script type="text/javascript" src="${s.base}/mobile/js/dropload.min.js"></script>
    <script>
        var memberId = '${memberId}';
        $(function(){
            show(1);
        });

        function show(type) {
            $('#showContent').html("");
            // 每页展示4个
            var num = 2;
            var pageStart = 0,pageEnd = 0;
            // dropload
            $('#content_div').dropload({
                scrollArea : window,
                loadDownFn : function(me){
                    pageStart++;
                    $.post("/activity/jsonListOrder",{
                        limit : num,
                        page : pageStart,
                        orderType : type,
                        status : 1
                    },function(resultInfo){
                        console.log(resultInfo);
                        if (resultInfo.code == 0){
                            var result = '';
                            if (resultInfo.data!=null && resultInfo.data.length > 0){
                                for(var i=0;i<resultInfo.data.length;i++){
                                    var items=resultInfo.data[i];
                                    console.log(items);
                                    var url = "/phone/selectActivityEntity?memberId="+memberId+"&activityId="+items.id;
                                    result += ' <ul>'+
                                        '<a href="'+url+'"><li><img src="'+items.imageOne+'" /></li></a>'+
                                        '<dl>'+
                                        '<dt>['+items.title+"]"+items.itemTitle+'</dt>'+
                                        '<dd><span><em style="width:'+items.progress+'%;"></em></span>'+
                                        '<a href="javascript:void(0)" onclick="memberCart(this);" data-itemid="'+items.itemId+'">加入清单</a>'+
                                        '<p>开奖进度 <em>'+items.progress+'%</em></p>'+
                                        '</dd>'+
                                        '</dl>'+
                                        '</ul>';
                                }
                            }
                            $('#showContent').append(result);

                            // 每次数据加载完，必须重置
                            if(resultInfo.isLastPage||resultInfo.isLastPage=="true"){
                                me.lock();
                                // 无数据
                                me.noData();
                                $(".dropload-down").remove();
                            }else {
                                me.resetload();
                            }
                        }
                    },"json");
                }
            });
        }

        function memberCart(obj){
            var itemId = $(obj).attr("data-itemid");
            $.post("/cart/updateOrAddEntity",{
                memberId : memberId,
                itemId : itemId
            },function(result){
                if(1==result.returnInfo.state){
                    showLayerAlertNoReload("操作成功！");
                }else{
                    showLayerAlertNoReload(result.returnInfo.errorMsg);
                }
            },"json");
            return false;
        }
    </script>
    <script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
	</body>

</html>